package com.hxzy.frame;

import android.animation.Animator;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RadioGroup;

import com.hxzy.childMeasure.leftButton;
import com.hxzy.childMeasure.rightButton;
import com.hxzy.login.R;


/**
 * Created by user on 2016/9/21.
 */

public class fragmentMeasure extends Fragment {
    private View layoutView;

    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        layoutView = inflater.inflate(R.layout.fragment_measure,null);

        return  layoutView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        showFragment(new leftButton());
        RadioGroup radiotip = (RadioGroup)layoutView.findViewById(R.id.radio_tip);
        radiotip.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if (checkedId == R.id.leftbutton){
                    showFragment(new leftButton());
                }else {
                    showFragment(new rightButton());
                }
            }
        });

    }
    private void  showFragment(Fragment fragment){
        FragmentTransaction fragmentTransaction = getChildFragmentManager().beginTransaction();
        fragmentTransaction.replace(R.id.measure_frame,fragment);
        fragmentTransaction.commit();
    }


}
